<template>
	<view>
		<!-- <u-navbar title="个人中心" @rightClick="rightClick" :autoBack="true" leftIcon=''>
		</u-navbar> -->
		
		
		<view class="info u-p-30">
			<view class="info_left">
				<image src="../../static/logo.png" mode=""></image>
				<text class="u-m-l-20" >{{info.nick_name||'请填写'}}</text>
			</view>
			<text @click="$goTo('/pagesT/Tchangeinfo/Tchangeinfo')" >修改资料</text>
		</view>
		
		<view class="cellbox">
			<!-- <view class="cellboxitem u-m-t-100" @click="tourl(1)">
				<text>教案</text>
				<u-icon name='arrow-right' ></u-icon>
			</view>
			
			<view class="cellboxitem u-m-t-10" @click="tourl(2)">
				<text>课程</text>
				<u-icon name='arrow-right' ></u-icon>
			</view>
			
			<view class="cellboxitem u-m-t-10" @click="tourl(3)">
				<text>学情</text>
				<u-icon name='arrow-right' ></u-icon>
			</view> -->
			<view class="cellboxitem u-m-t-10" @click="$goTo('/pagesT/teachermy/additem')">
				<text>添加学生信息</text>
				<u-icon name='arrow-right' ></u-icon>
			</view>
			<view class="cellboxitem u-m-t-10" @click="$goTo('/pages/feedback/feedback')">
				<text>使用建议与问题反馈</text>
				<u-icon name='arrow-right' ></u-icon>
			</view>
			<view class="cellboxitem u-m-t-10" @click="logout">
				<text>退出登录</text>
				<u-icon name='arrow-right' ></u-icon>
			</view>
		</view>
		
		
		<teachertabbar :value='3'></teachertabbar>
		
	</view>
</template>

<script>
	import teachertabbar from '../../components/teachertabbar.vue';
	export default {
		components: {
			teachertabbar
		},
		data() {
			return {
				info:{}
			};
		},
		onShow() {
			this.init()
		},
		methods:{
			init(){
				this.$api.get('/user/info',{}).then(res=>{
					this.info = res.data
				}).catch(err=>{
					this.$toast(err.message)
					setTimeout(()=>{
						uni.reLaunch({
							url:'/pages/login/login'
						})
					},1000)
				})
			},
			logout(){
				uni.removeStorageSync('token')
				uni.removeStorageSync('role')
				uni.removeStorageSync('tokenHead')
				this.$toast('退出成功~')
				setTimeout(()=>{
					uni.reLaunch({
						url:'/pages/login/login'
					})
				},1000)
			},
			tourl(index){
				if(index==1){
					uni.redirectTo({
						url:'/pagesT/index/index'
					})
				}else if(index==2){
					uni.redirectTo({
						url:'/pagesT/class/class'
					})
				}else{
					uni.redirectTo({
						url:'/pagesT/xq/xq'
					})
				}
			}
		}
	}
</script>

<style lang="scss">
.info{
	width: 100vw;
	box-sizing: border-box;
	background-color: #fff;
	display: flex;
	align-items: center;
	justify-content: space-between;
	image{
		width: 140rpx;
		height: 140rpx;
		border-radius: 50%;
	}
	.info_left{
		display: flex;
		align-items: center;
	}
}
.cellboxitem{
	display: flex;
	align-items: center;
	justify-content: space-between;
	width: 100vw;
	padding: 50rpx 20rpx;
	box-sizing: border-box;
	background-color: #fff;
}
</style>